/*-*-C-*-
 * Drag-n-drop header
 */

#ifndef __defined_dragdrop_h
#define __defined_dragdrop_h


typedef struct
{
    unsigned int dragflags;            /* as passed to dragdrop_start */
    int *filetypes;                    /* as passed to dragdrop_start */
    int claimant;                      /* task handle of claimant, -1 for none */
    unsigned int claimantsflags;       /* only if claimant != -1 */
    int claimantsref;                  /* only if claimant != -1 */
    int *claimantstypes;               /* only if claimant != -1 */
    PointerInfoRec mouse;
} DragDropCallbackRec, *DragDropCallbackPtr;

typedef error * (*DragDropCallback)(void *, DragDropCallbackPtr);

extern void dragdrop_scroll_pointer (void);
extern void dragdrop_normal_pointer (void);
extern Bool dragdrop_nudge (int keycode, int n);
extern error * dragdrop_start (RectPtr bbox,            /* screen-relative, in OS Units */
                               Bool truesz,             /* TRUE -> size of bbox is data's real size */
                               unsigned int dragflags,  /* as for Message_Dragging */
                               int *filetypes,          /* -1 terminated */
                               DragDropCallback cback,
                               void *closure,
                               char *spritename,
                               int numselected);
extern int dragdrop_claimref (void);
extern int dragdrop_claimwin (void);
extern error * dragdrop_cancel (void);
extern error * dragdrop_message_dragging (MessageDraggingPtr msg);
extern Bool dragdrop_scroll (WindowPtr win, PointPtr position, Bool *removeptr);

/* this function must be supplied by the client */
extern error * dragdrop_accept (int windowhandle, MessageDraggingPtr msg, int *claimref);

#endif
